﻿using System.Data.Entity;
using Home.Web.Models.Resume;
using Home.Web.data;

namespace Home.Web.Data
{
    public class ResumeDbContext:DbContext
    {
        public ResumeDbContext() : base("Resume")
        {
            Configuration.LazyLoadingEnabled = false;
            Configuration.ProxyCreationEnabled = false;
            Database.SetInitializer(new MigrateDatabaseToLatestVersion<ResumeDbContext, ResumeMigrationsConfiguration>());
        }

        //static ResumeDbContext()
        //{
        //    Database.SetInitializer(new ResumeDatabaseInitializer());    
        //}

        public DbSet<Resume> Resumes { get; set; }
        public DbSet<PersonalInfo> PersonalInfos { get; set; }
        public DbSet<Employer> Employers { get; set; }
        public DbSet<Project> Projects { get; set; }
        public DbSet<ProjectDetail> ProjectDetails { get; set; }
        public DbSet<Skill> Skills { get; set; }
        public DbSet<Summary> Summaries { get; set; }
        public DbSet<Education> Educations { get; set; }

        public System.Data.Entity.DbSet<Home.Web.Models.Resume.SkillType> SkillTypes { get; set; }
    }

    class ResumeDatabaseInitializer:DropCreateDatabaseIfModelChanges<ResumeDbContext>
    {

    }
}
